public class ProductNumberEqualityComparer : IEqualityComparer<Product>
{
public int GetHashCode(Product obj)
{
return (obj == null) ? 0 : obj.ProductNumber.GetHashCode();
}
public bool Equals(Product x, Product y)
{
if (ReferenceEquals(x, y)) return true;
if (x == null || y == null) return false;
return x.ProductNumber == y.ProductNumber;
}
}